<?php
/**
 * fldcms
 * ============================================================================
 * 版权所有 2017 福建华晟网络科技，并保留所有权利。
 * 网站地址: http://www.fldcms.cn
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * Author: fld
 * Date: 2017-07-01
 */
namespace app\index\controller;
use think\Controller;
use think\Session;
use think\Request;
class BaseController extends Controller{
	//操作消息
	public $msg = "";
	/**
	 * 析构函数
	 */
	function __construct(){
		parent::__construct();
		$model_article = model('Article');
		$model_link = model('Link');
		$model_tag = model('Tag');
		$model_cate = model('Cate');
		
		//网站配置信息
		$website_info = model('config')->getConfig(array('type'=>'website'));
		$this->assign('website_info',$website_info);
		
		$request= \think\Request::instance();
		$control_name = $request->controller();
		if($control_name == 'Cate'){
			$cate_id = input('param.id');
			$this->assign('cate_id',$cate_id);
		}	
		//置顶文章
		$top_list = $model_article->getTopArticle();
		$this->assign('top_list',$top_list);
		//热门文章
		$hot_list = $model_article->getHotArticle();
		$this->assign('hot_list',$hot_list);
		//友情链接
		$link_list = $model_link->getList(array('status'=>1));
		$this->assign('link_list',$link_list);
		//热点标签
		$tag_list = $model_tag->getList();
		$this->assign('tag_list',$tag_list);
		//分类信息
		$cate_list = $model_cate->getList();
		$this->assign('cate_list',$cate_list);
		
	}
	
	/*
	 * 初始化操作
	 */
	public function _initialize(){
		Session::start();
		Session::set("pre_url",'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
	}
	
}


?>